package cn.tonystack.test;

import cn.tonystack.domain.req.ShopCartReq;
import cn.tonystack.domain.res.PayOrderRes;
import cn.tonystack.service.IOrderService;
import com.alibaba.fastjson2.JSON;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

/**
 * @description：TODO
 * @author： tony.pan
 * @create： 2024/10/11 22:04
 */
@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class OrderServiceTest {

    @Resource
    private IOrderService orderService;

    @Test
    public void test_createOrder() throws Exception {
        ShopCartReq shopCartReq = new ShopCartReq();
        shopCartReq.setProductId("10001");
        shopCartReq.setUserId("xiaofuge");
        PayOrderRes payOrderRes = orderService.createOrder(shopCartReq);
        log.info("请求参数；{}", JSON.toJSONString(shopCartReq));
        log.info("测试结果：{}", JSON.toJSONString(payOrderRes));
    }

}
